import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import postCssPxToRem from 'postcss-pxtorem';
// import autoprefixer from 'autoprefixer';

// https://vitejs.dev/config/
export default defineConfig({
  base: '/exams/',
  build: {
    assetsPublicPath:'/exams/'
  },
  server:{
    host:"0.0.0.0"
  },
  plugins: [
    vue(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
    // autoprefixer({
    //   overrideBrowserslist: [
    //     'Android 4.1', 'iOS 7.1', "Chrome > 31", "ff > 31", 'ie >= 8', "last 10 version"
    //   ],
    //   grid: true
    // }),
    postCssPxToRem({
      rootValue: 37.5,
      propList: ['*'],
      unitPrecision: 5
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
